/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Classes;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Jaroslav
 */
@Entity
@Table(name = "version")
@NamedQueries({@NamedQuery(name = "Version.findByVersionId", query = "SELECT v FROM Version v WHERE v.versionId = :versionId"), @NamedQuery(name = "Version.findByProjectId", query = "SELECT v FROM Version v WHERE v.projectId = :projectId"), @NamedQuery(name = "Version.findByVersionNumber", query = "SELECT v FROM Version v WHERE v.versionNumber = :versionNumber"), @NamedQuery(name = "Version.findByReleaseDate", query = "SELECT v FROM Version v WHERE v.releaseDate = :releaseDate")})
public class Version implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "version_id", nullable = false)
    private Integer versionId;
    @Column(name = "project_id", nullable = false)
    private int projectId;
    @Column(name = "version_number", nullable = false)
    private String versionNumber;
    @Column(name = "release_date", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date releaseDate;

    public Version() {
    }

    public Version(Integer versionId) {
        this.versionId = versionId;
    }

    public Version(Integer versionId, int projectId, String versionNumber, Date releaseDate) {
        this.versionId = versionId;
        this.projectId = projectId;
        this.versionNumber = versionNumber;
        this.releaseDate = releaseDate;
    }

    public Integer getVersionId() {
        return versionId;
    }

    public void setVersionId(Integer versionId) {
        this.versionId = versionId;
    }

    public int getProjectId() {
        return projectId;
    }

    public void setProjectId(int projectId) {
        this.projectId = projectId;
    }

    public String getVersionNumber() {
        return versionNumber;
    }

    public void setVersionNumber(String versionNumber) {
        this.versionNumber = versionNumber;
    }

    public Date getReleaseDate() {
        return releaseDate;
    }

    public void setReleaseDate(Date releaseDate) {
        this.releaseDate = releaseDate;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (versionId != null ? versionId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Version)) {
            return false;
        }
        Version other = (Version) object;
        if ((this.versionId == null && other.versionId != null) || (this.versionId != null && !this.versionId.equals(other.versionId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Classes.Version[versionId=" + versionId + "]";
    }

}
